<% extends 'base.html' %>
<% block title %>产品入库<% endblock %>
<% block body %>
<% block head %>
    <script type="text/javascript" src='http://res.wx.qq.com/open/js/jweixin-1.0.0.js'></script>
<% endblock %>

<div class='page' id='delivery-in-list' ms-controller='delivery-in-list'>
    <header class="bar bar-nav">
        <div class="bar" >
          <div class="searchbar move-search-bar">
            <a class='search-scan-code' ms-click='scanCode'>扫码</a>
            <div class="search-input">
              <label class="icon icon-search" for="search"></label>
              <input type="search" placeholder='请输入关键字...' ms-duplex='search_word' />
              <div class='search-input-type'>{{search_word_display}}</div>
              <div class='card search-metal'>
                <ul>
                    <li ms-click="do_search('all')">搜索全部：{{search_word}}</li>
                    <li ms-click="do_search('product_name')">搜索产品名称：{{search_word}}</li>
                    <li ms-click="do_search('picking_name')">搜索关联单据：{{search_word}}</li>
                </ul>
              </div>
            </div>
          </div>
        </div>
    </header>

    <div class="content" >
        <input name='hidden' id='hidden_max_items' value='${max_items}' ms-visible='false' />
        <input name='hidden' id='hidden_is_warehouse_user' value='${is_warehouse_user}' ms-visible='false' />
        <div class='product-search-sort-bar'>
          <ul>
            <li ms-click="sort('product_name')">
              <div> <span ms-class="product-color-black:sort_name != 'product_name'">产品名称</span><span ms-visible="sort_name == 'product_name'" class='icon-arrow' ms-class="icon-arrow-rotate:sort_direction == 'down'"><</span></div>
            </li>
            <li ms-click="sort('picking_name')">
              <div> <span ms-class="product-color-black:sort_name != 'picking_name'">关联单据</span><span ms-visible="sort_name == 'picking_name'" class='icon-arrow' ms-class="icon-arrow-rotate:sort_direction == 'down'"><</span></div>
            </li>
            <li ms-click="sort('product_qty')">
              <div> <span ms-class="product-color-black:sort_name != 'product_qty'">数量</span><span ms-visible="sort_name == 'product_qty'" class='icon-arrow' ms-class="icon-arrow-rotate:sort_direction == 'down'"><</span></div>
            </li>
          </ul>
        </div>

        <div>
            <div class="card" ms-repeat-move='moves' ms-if-loop='move.visible'>
              <div class="card-content">
                <div class="list-block media-list">
                  <ul>
                    <li class="delivery-move-item item-content">
                      <div class="item-media">
                          <img width="80" height="80" ms-attr-src="/website/image/product.product/{{move.product_id}}/image" />
                      </div>
                      <div class="item-inner ">
                        <div class="item-title-row">
                          <div class="item-title">{{move.product_name}} <span style='color:red'>({{move.product_qty}}{{move.product_uom_translation || move.product_uom}})</div>
                          <!-- <div class='item-after' style='color:red'>{{move.product_qty}}{{move.product_uom}}</div> -->
                        </div>
                        <div class="item-subtitle">关联单据：{{move.picking_name}}</div>

                        <div class="item-subtitle item-input location-dest">
                            <select ms-on-change="location_change(move.id, move.location)" ms-each-stock="stocks" ms-duplex="move.location">
                                <option ms-attr-value="stock.name">{{stock.name}}</option>
                            </select>
                        </div>
                      </div>

                      <div class='card-confirm-button' ms-visible='is_warehouse_user' ms-click='receive_product(move)'>收货</div>
                    </li>
                  </ul>
                </div>

              </div>

            </div>

            <div class='list-page' ms-class='list-page-bottom:current_length - current_index <= 4' ms-visible='is_warehouse_user' >
              <div class='list-page-info'>{{current_page}} of {{pages}}</div>
              <div>
                <span ms-click='previous_page' class='icon icon-left' ms-class='icon-disable:current_page==1'></span>
                <span ms-click='next_page' class='icon icon-right' ms-class='icon-disable:current_length - current_index <= items_per_page'></span>
              </div>
            </div>

        </div>
    </div>
</div>

<% endblock %>

<% block script %>
    ${ super() }

    <script type="text/javascript" src="/dftg_weixin/static/src/js/delivery_in_list.js"></script>
<% endblock %>
